package com.gopay.webtest.controller;

import java.util.Date;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.gopay.webtest.controller.base.BaseController;
import com.gopay.webtest.handler.GsrtHandler;
import com.gopay.webtest.handler.P2PSignHandler;
import com.gopay.webtest.util.DateUtils;
import com.gopay.webtest.vo.GsrtAccountParamVo;
import com.gopay.webtest.vo.GsrtBusinessQueryParamVo;
import com.gopay.webtest.vo.GsrtCustBidVo;
import com.gopay.webtest.vo.GsrtCustSignedParamVO;
import com.gopay.webtest.vo.GsrtDrawParamVo;
import com.gopay.webtest.vo.GsrtFailureBidParamVo;
import com.gopay.webtest.vo.GsrtLoanDisbursementsParamVO;
import com.gopay.webtest.vo.GsrtRdtQueryParamVo;
import com.gopay.webtest.vo.GsrtRechargeParamVo;
import com.gopay.webtest.vo.GsrtRepayParamVo;
import com.gopay.webtest.vo.GsrtReturnedMoneyParamVO;
import com.gopay.webtest.vo.GsrtSignedListParamVo;
import com.gopay.webtest.vo.GsrtTenderParamVo;
import com.gopay.webtest.vo.GsrtTenderupdateParamVo;
import com.gopay.webtest.vo.GsrtTransferParamVo;
import com.gopay.webtest.vo.GsrttenderListParamVo;
import com.gopay.webtest.xml.XmlDao;

/**
 * P2P Controller
 * @P2PController.java
 * @author fanghw
 * @2014-4-18 上午9:53:29  www.gopay.com.cn Inc.All rights reserved.
 */
@RequestMapping("/gsrt")
@Controller
public class GsrtController extends BaseController {
    @Resource(name = "xmlDao")
    private XmlDao xmlDao;

    @Resource(name = "p2PSignHandler")
    private P2PSignHandler p2PSignHandler;
    
    @Resource(name = "gsrtHandler")
    private GsrtHandler gsrtHandler;
    
    /**
     * 赵亚亭
     * 提现
     * @return
     */
    @RequestMapping("/draw")
    public ModelAndView draw() {
        ModelAndView mv = new ModelAndView();

        try {
            Map<String, String> map = xmlDao.readData4Map("gsrt_draw", "draw");

            
            if (map.containsKey("tranDateTime")) {
                map.remove("tranDateTime");
                map.put("tranDateTime", DateUtils.format(new Date(), "yyyyMMddHHmmss"));
            }

            mv = new ModelAndView("gsrt.draw.draw");
            mv.addObject("drawInfo", map);
        } catch (Exception e) {
            logger.error("跳转到转账页面异常", e);
        }

        return mv;
    }
    
    /**
     * 赵亚亭
     * 执行提现
     * @return
     */
    @RequestMapping("/doDraw")
    public ModelAndView doDraw(@ModelAttribute GsrtDrawParamVo paramVo) {
        ModelAndView mv = new ModelAndView();

        try {
            String backgroundMerUrl = paramVo.getBackgroundMerUrl();
            if(backgroundMerUrl!=null&&!backgroundMerUrl.equals("")){
                backgroundMerUrl = backgroundMerUrl+ "?id="+ paramVo.getVerficationCode();
            }
            
            String frontMerUrl = paramVo.getFrontMerUrl();
            if(frontMerUrl!=null&&!frontMerUrl.equals("")){
                frontMerUrl = frontMerUrl+ "?id="
                        + paramVo.getVerficationCode();
            }
            paramVo.setBackgroundMerUrl(backgroundMerUrl);
            paramVo.setFrontMerUrl(frontMerUrl);
            
            //国付宝服务器时间,本应该从网关time接口获取,此处为方便测试,取页面上的可输入时间
            paramVo.setGopayServerTime(paramVo.getTranDateTime());
            
            // 签名
            gsrtHandler.sign(paramVo.getTranCode()+"_"+paramVo.getVersion()+"_"+"PC", "signType", "signValue", paramVo, getRequest());
            
           
            
            mv.setViewName("gsrt.draw.doDraw");
            mv.addObject("paramVo", paramVo);
        } catch (Exception e) {
            logger.error("执行提现异常", e);
        }

        return mv;
    }
    
    
    /**
     * 
     * 发标
     * @return
     */
    @RequestMapping("/tender")
    public ModelAndView tender() {
        ModelAndView mv = new ModelAndView();

        try {
            Map<String, String> map = xmlDao.readData4Map("gsrt_tender", "tender");
            if (map.containsKey("tranDateTime")) {
                map.remove("tranDateTime");
                map.put("tranDateTime", DateUtils.format(new Date(), "yyyyMMddHHmmss"));
            }
            mv = new ModelAndView("gsrt.tender.tender");
            mv.addObject("config", map);
        } catch (Exception e) {
            logger.error("跳转到转账页面异常", e);
        }

        return mv;
    }
    
    /**
     * 
     * 
     * @return
     */
    @RequestMapping("/dotender")
    public ModelAndView doBind(@ModelAttribute GsrtTenderParamVo paramVo) {
        ModelAndView mv = new ModelAndView();

        try {
            String backgroundMerUrl = paramVo.getBackgroundMerUrl();
            if(backgroundMerUrl!=null&&!backgroundMerUrl.equals("")){
                backgroundMerUrl = backgroundMerUrl+ "?id="+ paramVo.getVerficationCode();
            }
            
            String frontMerUrl = paramVo.getFrontMerUrl();
            if(frontMerUrl!=null&&!frontMerUrl.equals("")){
                frontMerUrl = frontMerUrl+ "?id="
                        + paramVo.getVerficationCode();
            }
            paramVo.setBackgroundMerUrl(backgroundMerUrl);
            paramVo.setFrontMerUrl(frontMerUrl);
            
            //国付宝服务器时间,本应该从网关time接口获取,此处为方便测试,取页面上的可输入时间
            paramVo.setGopayServerTime(paramVo.getTranDateTime());
            
            // 签名
            gsrtHandler.sign(paramVo.getTranCode()+"_"+paramVo.getVersion(), "signType", "signValue", paramVo, getRequest());
            
           
            
            mv.setViewName("gsrt.tender.dotender");
            mv.addObject("paramVo", paramVo);
        } catch (Exception e) {
            logger.error("执行提现异常", e);
        }

        return mv;
    }
    
    
    
    /**
     * 
     * 投标
     * @return
     */
    @RequestMapping("/bid")
    public ModelAndView bid() {
        ModelAndView mv = new ModelAndView();

        try {
            Map<String, String> map = xmlDao.readData4Map("gsrt_bid", "bid");

            
            if (map.containsKey("tranDateTime")) {
                map.remove("tranDateTime");
                map.put("tranDateTime", DateUtils.format(new Date(), "yyyyMMddHHmmss"));
            }

            mv = new ModelAndView("gsrt.bid.bid");
            mv.addObject("config", map);
        } catch (Exception e) {
            logger.error("跳转到转账页面异常", e);
        }

        return mv;
    }
    
    /**
     * 投标 执行界面
     * 
     * @return
     */
    @RequestMapping("/dobid")
    public ModelAndView dobid(@ModelAttribute GsrtCustBidVo paramVo) {
        ModelAndView mv = new ModelAndView();

        try {
            String backgroundMerUrl = paramVo.getBackgroundMerUrl();
            if(backgroundMerUrl!=null&&!backgroundMerUrl.equals("")){
                backgroundMerUrl = backgroundMerUrl+ "?id="+ paramVo.getVerficationCode();
            }
            
            String frontMerUrl = paramVo.getFrontMerUrl();
            if(frontMerUrl!=null&&!frontMerUrl.equals("")){
                frontMerUrl = frontMerUrl+ "?id="
                        + paramVo.getVerficationCode();
            }
            paramVo.setBackgroundMerUrl(backgroundMerUrl);
            paramVo.setFrontMerUrl(frontMerUrl);
            
            //国付宝服务器时间,本应该从网关time接口获取,此处为方便测试,取页面上的可输入时间
            paramVo.setGopayServerTime(paramVo.getTranDateTime());
            
            // 签名
            gsrtHandler.sign(paramVo.getTranCode()+"_"+paramVo.getVersion()+"_"+"PC", "signType", "signValue", paramVo, getRequest());
            mv.setViewName("gsrt.bid.dobid");
            mv.addObject("paramVo", paramVo);
        } catch (Exception e) {
            logger.error("执行提现异常", e);
        }

        return mv;
    }
    
    
    /**
     * 赵亚亭 2016-1-18
     * G商融通还款测试页面
     * @return
     */
    @RequestMapping("/repay")
    public ModelAndView repay() {
        ModelAndView mv = new ModelAndView();

        try {
            Map<String, String> map = xmlDao.readData4Map("gsrt_repay", "repay");

            
            if (map.containsKey("tranDateTime")) {
                map.remove("tranDateTime");
                map.put("tranDateTime", DateUtils.format(new Date(), "yyyyMMddHHmmss"));
            }

            mv = new ModelAndView("gsrt.repay.repay");
            mv.addObject("repayinfo", map);
        } catch (Exception e) {
            logger.error("跳转到还款页面异常", e);
        }

        return mv;
    }
    
    
    /**
     * 赵亚亭 2016-1-18
     * G商融通还款处理动作
     * @return
     */
    @RequestMapping("/doRepay")
    public ModelAndView doRepay(@ModelAttribute GsrtRepayParamVo paramVo) {
        ModelAndView mv = new ModelAndView();

        try {
            String backgroundMerUrl = paramVo.getBackgroundMerUrl();
            if(backgroundMerUrl!=null&&!backgroundMerUrl.equals("")){
                backgroundMerUrl = backgroundMerUrl+ "?id="+ paramVo.getVerficationCode();
            }
            
            String frontMerUrl = paramVo.getFrontMerUrl();
            if(frontMerUrl!=null&&!frontMerUrl.equals("")){
                frontMerUrl = frontMerUrl+ "?id="
                        + paramVo.getVerficationCode();
            }
            paramVo.setBackgroundMerUrl(backgroundMerUrl);
            paramVo.setFrontMerUrl(frontMerUrl);
            
            //国付宝服务器时间,本应该从网关time接口获取,此处为方便测试,取页面上的可输入时间
            paramVo.setGopayServerTime(paramVo.getTranDateTime());
            
            // 签名
            gsrtHandler.sign(paramVo.getTranCode()+"_"+paramVo.getVersion()+"_"+"PC", "signType", "signValue", paramVo, getRequest());
            
           logger.info(paramVo.toString());
            
            mv.setViewName("gsrt.repay.dorepay");
            mv.addObject("paramVo", paramVo);
        } catch (Exception e) {
            logger.error("执行还款异常", e);
        }

        return mv;
    }
   
    
    /**
     * 赵亚亭 2016-1-19
     * G商融通转账测试页面
     * @return
     */
    @RequestMapping("/transfer")
    public ModelAndView transfer() {
        ModelAndView mv = new ModelAndView();

        try {
            Map<String, String> map = xmlDao.readData4Map("gsrt_transfer", "transfer");

            
            if (map.containsKey("tranDateTime")) {
                map.remove("tranDateTime");
                map.put("tranDateTime", DateUtils.format(new Date(), "yyyyMMddHHmmss"));
            }

            mv = new ModelAndView("gsrt.transfer.transfer");
            mv.addObject("transferInfo", map);
        } catch (Exception e) {
            logger.error("跳转到转账页面异常", e);
        }

        return mv;
    }
    
    
    /**
     * 赵亚亭 2016-1-19
     * G商融通转账处理动作
     * @return
     */
    @RequestMapping("/doTransfer")
    public ModelAndView doTransfer(@ModelAttribute GsrtTransferParamVo paramVo) {
        ModelAndView mv = new ModelAndView();

        try {
            String backgroundMerUrl = paramVo.getBackgroundMerUrl();
            if(backgroundMerUrl!=null&&!backgroundMerUrl.equals("")){
                backgroundMerUrl = backgroundMerUrl+ "?id="+ paramVo.getVerficationCode();
            }
            
            String frontMerUrl = paramVo.getFrontMerUrl();
            if(frontMerUrl!=null&&!frontMerUrl.equals("")){
                frontMerUrl = frontMerUrl+ "?id="
                        + paramVo.getVerficationCode();
            }
            paramVo.setBackgroundMerUrl(backgroundMerUrl);
            paramVo.setFrontMerUrl(frontMerUrl);
            
            //国付宝服务器时间,本应该从网关time接口获取,此处为方便测试,取页面上的可输入时间
            paramVo.setGopayServerTime(paramVo.getTranDateTime());
            
            // 签名
            gsrtHandler.sign(paramVo.getTranCode()+"_"+paramVo.getVersion(), "signType", "signValue", paramVo, getRequest());
            
           logger.info(paramVo.toString());
            
            mv.setViewName("gsrt.transfer.doTransfer");
            mv.addObject("paramVo", paramVo);
        } catch (Exception e) {
            logger.error("执行转账异常", e);
        }

        return mv;
    }
   
    
    /**
     * 赵亚亭 2016-1-19
     * G商融通流标测试页面
     * @return
     */
    @RequestMapping("/failureBid")
    public ModelAndView failureBid() {
        ModelAndView mv = new ModelAndView();

        try {
            Map<String, String> map = xmlDao.readData4Map("gsrt_failureBid", "failureBid");

            
            if (map.containsKey("tranDateTime")) {
                map.remove("tranDateTime");
                map.put("tranDateTime", DateUtils.format(new Date(), "yyyyMMddHHmmss"));
            }

            mv = new ModelAndView("gsrt.failureBid.failureBid");
            mv.addObject("failureBidInfo", map);
        } catch (Exception e) {
            logger.error("跳转到流标页面异常", e);
        }

        return mv;
    }
    
    
    /**
     * 赵亚亭 2016-1-19
     * G商融通流标处理动作
     * @return
     */
    @RequestMapping("/doFailureBid")
    public ModelAndView doFailureBid(@ModelAttribute GsrtFailureBidParamVo paramVo) {
        ModelAndView mv = new ModelAndView();

        try {
            String backgroundMerUrl = paramVo.getBackgroundMerUrl();
            if(backgroundMerUrl!=null&&!backgroundMerUrl.equals("")){
                backgroundMerUrl = backgroundMerUrl+ "?id="+ paramVo.getVerficationCode();
            }
            
            String frontMerUrl = paramVo.getFrontMerUrl();
            if(frontMerUrl!=null&&!frontMerUrl.equals("")){
                frontMerUrl = frontMerUrl+ "?id="
                        + paramVo.getVerficationCode();
            }
            paramVo.setBackgroundMerUrl(backgroundMerUrl);
            paramVo.setFrontMerUrl(frontMerUrl);
            
            //国付宝服务器时间,本应该从网关time接口获取,此处为方便测试,取页面上的可输入时间
            paramVo.setGopayServerTime(paramVo.getTranDateTime());
            
            // 签名
            gsrtHandler.sign(paramVo.getTranCode()+"_"+paramVo.getVersion(), "signType", "signValue", paramVo, getRequest());
            
           logger.info(paramVo.toString());
            
            mv.setViewName("gsrt.failureBid.doFailureBid");
            mv.addObject("paramVo", paramVo);
        } catch (Exception e) {
            logger.error("执行流标异常", e);
        }

        return mv;
    }
    
    /**
     * 赵亚亭 2016-1-19
     * G商融通业务查询测试页面
     * @return
     */
    @RequestMapping("/businessQuery")
    public ModelAndView businessQuery() {
        ModelAndView mv = new ModelAndView();

        try {
            Map<String, String> map = xmlDao.readData4Map("gsrt_businessQuery", "businessQueryInfo");

            
            if (map.containsKey("tranDateTime")) {
                map.remove("tranDateTime");
                map.put("tranDateTime", DateUtils.format(new Date(), "yyyyMMddHHmmss"));
            }
            
            mv = new ModelAndView("gsrt.businessQuery.businessQuery");
            mv.addObject("businessQueryInfo", map);
        } catch (Exception e) {
            logger.error("跳转到业务查询页面异常", e);
        }

        return mv;
    }
    
    
    /**
     * 赵亚亭 2016-1-19
     * G商融通业务查询处理动作
     * @return
     */
    @RequestMapping("/doBusinessQuery")
    public ModelAndView doBusinessQuery(@ModelAttribute GsrtBusinessQueryParamVo paramVo) {
        ModelAndView mv = new ModelAndView();
        logger.error("进入doBusinessQuery");

        try {
            String backgroundMerUrl = paramVo.getBackgroundMerUrl();
            if(backgroundMerUrl!=null&&!backgroundMerUrl.equals("")){
                backgroundMerUrl = backgroundMerUrl+ "?id="+ paramVo.getVerficationCode();
            }
            
            String frontMerUrl = paramVo.getFrontMerUrl();
            if(frontMerUrl!=null&&!frontMerUrl.equals("")){
                frontMerUrl = frontMerUrl+ "?id="
                        + paramVo.getVerficationCode();
            }
            paramVo.setBackgroundMerUrl(backgroundMerUrl);
            paramVo.setFrontMerUrl(frontMerUrl);
            
            //国付宝服务器时间,本应该从网关time接口获取,此处为方便测试,取页面上的可输入时间
            paramVo.setGopayServerTime(paramVo.getTranDateTime());
            
            // 签名
            gsrtHandler.sign(paramVo.getTranCode()+"_"+paramVo.getVersion(), "signType", "signValue", paramVo, getRequest());
            
           logger.info("业务查询数据对象：" + paramVo.toString());
            
            mv.setViewName("gsrt.businessQuery.doBusinessQuery");
            mv.addObject("paramVo", paramVo);
        } catch (Exception e) {
            logger.error("执行业务查询异常", e);
        }

        return mv;
    }
    
    /**
     * 赵亚亭 2016-2-25
     * 充值页面
     * 
     * @return
     */
    @RequestMapping("/recharge")
    public ModelAndView recharge() {
    	ModelAndView mv = new ModelAndView();

        try {
            Map<String, String> map = xmlDao.readData4Map("gsrt_recharge", "recharge");

            
            if (map.containsKey("tranDateTime")) {
                map.remove("tranDateTime");
                map.put("tranDateTime", DateUtils.format(new Date(), "yyyyMMddHHmmss"));
            }

            mv = new ModelAndView("gsrt.recharge.recharge");
            mv.addObject("rechargeInfo", map);
        } catch (Exception e) {
            logger.error("跳转到充值页面异常", e);
        }

        return mv;
    }

    /**
     * 赵亚亭 2016-1-19
     * 执行充值
     * 
     * @return
     */

    @RequestMapping("/doRecharge")
    public ModelAndView doRecharge(@ModelAttribute GsrtRechargeParamVo paramVo) {
        ModelAndView mv = new ModelAndView();

        try {
            String backgroundMerUrl = paramVo.getBackgroundMerUrl();
            if(backgroundMerUrl!=null&&!backgroundMerUrl.equals("")){
                backgroundMerUrl = backgroundMerUrl+ "?id="+ paramVo.getVerficationCode();
            }
            
            String frontMerUrl = paramVo.getFrontMerUrl();
            if(frontMerUrl!=null&&!frontMerUrl.equals("")){
                frontMerUrl = frontMerUrl+ "?id="
                        + paramVo.getVerficationCode();
            }
            paramVo.setBackgroundMerUrl(backgroundMerUrl);
            paramVo.setFrontMerUrl(frontMerUrl);
            
            //国付宝服务器时间,本应该从网关time接口获取,此处为方便测试,取页面上的可输入时间
            paramVo.setGopayServerTime(paramVo.getTranDateTime());
            
            // 签名
            gsrtHandler.sign(paramVo.getTranCode()+"_"+paramVo.getVersion()+"_"+"PC", "signType", "signValue", paramVo, getRequest());
            
           
            
            mv.setViewName("gsrt.recharge.doRecharge");
            mv.addObject("paramVo", paramVo);
        } catch (Exception e) {
            logger.error("执行提现异常", e);
        }

        return mv;
    }
    
    /**
     * 跳转到放款页面
     * 
     * @return
     */
    @RequestMapping("/loanDisbursements")
    public ModelAndView loanDisbursements() {
        ModelAndView mv = new ModelAndView();

        try {
            Map<String, String> map = xmlDao.readData4Map("gsrt_loanDisbursements", "loanDisbursements");

            
            if (map.containsKey("tranDateTime")) {
                map.remove("tranDateTime");
                map.put("tranDateTime", DateUtils.format(new Date(), "yyyyMMddHHmmss"));
            }

            mv = new ModelAndView("gsrt.loanDisbursements");
            mv.addObject("config", map);
        } catch (Exception e) {
            logger.error("跳转到放款页面", e);
        }

        return mv;
    }

    /**
     * 执行放款
     * 
     * @return
     */
    @RequestMapping("/doLoanDisbursements")
    public ModelAndView doLoanDisbursements(@ModelAttribute GsrtLoanDisbursementsParamVO paramVo) {
        ModelAndView mv = new ModelAndView();

        try {
            
            //国付宝服务器时间,本应该从网关time接口获取,此处为方便测试,取页面上的可输入时间
            paramVo.setGopayServerTime(paramVo.getTranDateTime());
            
            // 签名
            gsrtHandler.sign(paramVo.getTranCode()+"_"+paramVo.getVersion(), "signType", "signValue", paramVo, getRequest());

            mv.setViewName("gsrt.doLoanDisbursements");
            mv.addObject("paramVo", paramVo);
        } catch (Exception e) {
            logger.error("执行放款", e);
        }

        return mv;
    }
    
    /**
     * 跳转到回款页面
     * 
     * @return
     */
    @RequestMapping("/returnedMoney")
    public ModelAndView returnedMoney() {
        ModelAndView mv = new ModelAndView();

        try {
            Map<String, String> map = xmlDao.readData4Map("gsrt_returnedMoney", "returnedMoney");

            
            if (map.containsKey("tranDateTime")) {
                map.remove("tranDateTime");
                map.put("tranDateTime", DateUtils.format(new Date(), "yyyyMMddHHmmss"));
            }

            mv = new ModelAndView("gsrt.returnedMoney");
            mv.addObject("config", map);
        } catch (Exception e) {
            logger.error("跳转到回款页面", e);
        }

        return mv;
    }

    /**
     * 执行回款
     * 
     * @return
     */
    @RequestMapping("/doReturnedMoney")
    public ModelAndView doReturnedMoney(@ModelAttribute GsrtReturnedMoneyParamVO paramVo) {
        ModelAndView mv = new ModelAndView();

        try {
            //国付宝服务器时间,本应该从网关time接口获取,此处为方便测试,取页面上的可输入时间
            paramVo.setGopayServerTime(paramVo.getTranDateTime());
            
            // 签名
            gsrtHandler.sign(paramVo.getTranCode()+"_"+paramVo.getVersion(), "signType", "signValue", paramVo, getRequest());

            mv.setViewName("gsrt.doReturnedMoney");
            mv.addObject("paramVo", paramVo);
        } catch (Exception e) {
            logger.error("执行回款", e);
        }

        return mv;
    }
    
    /**
     * 跳转到签约页面
     * 
     * @return
     */
    @RequestMapping("/custSigned")
    public ModelAndView custSigned() {
        ModelAndView mv = new ModelAndView();

        try {
            Map<String, String> map = xmlDao.readData4Map("gsrt_custSigned", "custSigned");

            
            if (map.containsKey("tranDateTime")) {
                map.remove("tranDateTime");
                map.put("tranDateTime", DateUtils.format(new Date(), "yyyyMMddHHmmss"));
            }

            mv = new ModelAndView("gsrt.custSigned");
            mv.addObject("config", map);
        } catch (Exception e) {
            logger.error("跳转到签约页面", e);
        }

        return mv;
    }

    /**
     * 执行签约
     * 
     * @return
     */
    @RequestMapping("/doCustSigned")
    public ModelAndView doCustSigned(@ModelAttribute GsrtCustSignedParamVO paramVo) {
        ModelAndView mv = new ModelAndView();

        try {
            String backgroundMerUrl = paramVo.getBackgroundMerUrl();
            if(backgroundMerUrl!=null&&!backgroundMerUrl.equals("")){
                backgroundMerUrl = backgroundMerUrl+ "?id="+ paramVo.getVerficationCode();
            }
            
            String frontMerUrl = paramVo.getFrontMerUrl();
            if(frontMerUrl!=null&&!frontMerUrl.equals("")){
                frontMerUrl = frontMerUrl+ "?id="
                        + paramVo.getVerficationCode();
            }
            paramVo.setBackgroundMerUrl(backgroundMerUrl);
            paramVo.setFrontMerUrl(frontMerUrl);
            
            //国付宝服务器时间,本应该从网关time接口获取,此处为方便测试,取页面上的可输入时间
            paramVo.setGopayServerTime(paramVo.getTranDateTime());
            
            // 签名
            gsrtHandler.sign(paramVo.getTranCode()+"_"+paramVo.getVersion()+"_PC", "signType", "signValue", paramVo, getRequest());

            mv.setViewName("gsrt.doCustSigned");
            mv.addObject("paramVo", paramVo);
        } catch (Exception e) {
            logger.error("执行签约", e);
        }

        return mv;
    }
  
    
    /**
     * 跳转到页面
     * 
     * @return
     */
    @RequestMapping("/tenderup")
    public ModelAndView tenderup() {
        ModelAndView mv = new ModelAndView();

        try {
            Map<String, String> map = xmlDao.readData4Map("gsrt_tenderupdate", "tenderup");

            
            if (map.containsKey("tranDateTime")) {
                map.remove("tranDateTime");
                map.put("tranDateTime", DateUtils.format(new Date(), "yyyyMMddHHmmss"));
            }

            mv = new ModelAndView("gsrt.tender.tenderup");
            mv.addObject("config", map);
        } catch (Exception e) {
            logger.error("标的更新页面", e);
        }

        return mv;
    }

    /**
     * 执行标的更新
     * 
     * @return
     */
    @RequestMapping("/doupdatetender")
    public ModelAndView doupdatetender(@ModelAttribute GsrtTenderupdateParamVo paramVo) {
        ModelAndView mv = new ModelAndView();

        try {
            String backgroundMerUrl = paramVo.getBackgroundMerUrl();
            if(backgroundMerUrl!=null&&!backgroundMerUrl.equals("")){
                backgroundMerUrl = backgroundMerUrl+ "?id="+ paramVo.getVerficationCode();
            }
            
            String frontMerUrl = paramVo.getFrontMerUrl();
            if(frontMerUrl!=null&&!frontMerUrl.equals("")){
                frontMerUrl = frontMerUrl+ "?id="
                        + paramVo.getVerficationCode();
            }
            paramVo.setBackgroundMerUrl(backgroundMerUrl);
            paramVo.setFrontMerUrl(frontMerUrl);
            
            //国付宝服务器时间,本应该从网关time接口获取,此处为方便测试,取页面上的可输入时间
            paramVo.setGopayServerTime(paramVo.getTranDateTime());
            
            // 签名
            gsrtHandler.sign(paramVo.getTranCode()+"_"+paramVo.getVersion(), "signType", "signValue", paramVo, getRequest());

            mv.setViewName("gsrt.tender.doupdatetender");
            mv.addObject("paramVo", paramVo);
        } catch (Exception e) {
            logger.error("执行放款", e);
        }

        return mv;
    }
    
    
    
    
    
    /**
     * 
     * 账户查询
     * @return
     */
    @RequestMapping("/account")
    public ModelAndView account() {
        ModelAndView mv = new ModelAndView();

        try {
            Map<String, String> map = xmlDao.readData4Map("gsrt_account", "account");

            
            if (map.containsKey("tranDateTime")) {
                map.remove("tranDateTime");
                map.put("tranDateTime", DateUtils.format(new Date(), "yyyyMMddHHmmss"));
            }

            mv = new ModelAndView("gsrt.accounts.account");
            mv.addObject("config", map);
        } catch (Exception e) {
            logger.error("跳转到转账页面异常", e);
        }

        return mv;
    }
    
    /**
     * 执行账户查询
     * 
     * @return
     */
    @RequestMapping("/doaccount")
    public ModelAndView doaccount(@ModelAttribute GsrtAccountParamVo paramVo) {
        ModelAndView mv = new ModelAndView();

        try {
            String backgroundMerUrl = paramVo.getBackgroundMerUrl();
            if(backgroundMerUrl!=null&&!backgroundMerUrl.equals("")){
                backgroundMerUrl = backgroundMerUrl+ "?id="+ paramVo.getVerficationCode();
            }
            
            String frontMerUrl = paramVo.getFrontMerUrl();
            if(frontMerUrl!=null&&!frontMerUrl.equals("")){
                frontMerUrl = frontMerUrl+ "?id="
                        + paramVo.getVerficationCode();
            }
            paramVo.setBackgroundMerUrl(backgroundMerUrl);
            paramVo.setFrontMerUrl(frontMerUrl);
            
            //国付宝服务器时间,本应该从网关time接口获取,此处为方便测试,取页面上的可输入时间
            paramVo.setGopayServerTime(paramVo.getTranDateTime());
            
            // 签名
            gsrtHandler.sign(paramVo.getTranCode()+"_"+paramVo.getVersion(), "signType", "signValue", paramVo, getRequest());
            
           
            
            mv.setViewName("gsrt.accounts.doaccount");
            mv.addObject("paramVo", paramVo);
        } catch (Exception e) {
            logger.error("执行提现异常", e);
        }

        return mv;
    }
    
 
    
    /**
     * 
     * 标的查询
     * @return
     */
    @RequestMapping("/tenderlist")
    public ModelAndView tenderlist() {
        ModelAndView mv = new ModelAndView();

        try {
            Map<String, String> map = xmlDao.readData4Map("gsrt_tenderlist", "tenderlist");

            
            if (map.containsKey("tranDateTime")) {
                map.remove("tranDateTime");
                map.put("tranDateTime", DateUtils.format(new Date(), "yyyyMMddHHmmss"));
            }

            mv = new ModelAndView("gsrt.tender.tenderlist");
            mv.addObject("config", map);
        } catch (Exception e) {
            logger.error("跳转到转账页面异常", e);
        }

        return mv;
    }
    
    /**
     * 标的查询
     * 
     * @return
     */
    @RequestMapping("/dotenderlist")
    public ModelAndView tenderlist(@ModelAttribute GsrttenderListParamVo paramVo) {
        ModelAndView mv = new ModelAndView();

        try {
            String backgroundMerUrl = paramVo.getBackgroundMerUrl();
            if(backgroundMerUrl!=null&&!backgroundMerUrl.equals("")){
                backgroundMerUrl = backgroundMerUrl+ "?id="+ paramVo.getVerficationCode();
            }
            
            String frontMerUrl = paramVo.getFrontMerUrl();
            if(frontMerUrl!=null&&!frontMerUrl.equals("")){
                frontMerUrl = frontMerUrl+ "?id="
                        + paramVo.getVerficationCode();
            }
            paramVo.setBackgroundMerUrl(backgroundMerUrl);
            paramVo.setFrontMerUrl(frontMerUrl);
            
            //国付宝服务器时间,本应该从网关time接口获取,此处为方便测试,取页面上的可输入时间
            paramVo.setGopayServerTime(paramVo.getTranDateTime());
            
            // 签名
            gsrtHandler.sign(paramVo.getTranCode()+"_"+paramVo.getVersion(), "signType", "signValue", paramVo, getRequest());
            
           
            
            mv.setViewName("gsrt.tender.dotenderlist");
            mv.addObject("paramVo", paramVo);
        } catch (Exception e) {
            logger.error("执行提现异常", e);
        }

        return mv;
    }
    
    
    /**
     * 
     * 标的查询
     * @return
     */
    @RequestMapping("/signed")
    public ModelAndView signed() {
        ModelAndView mv = new ModelAndView();

        try {
            Map<String, String> map = xmlDao.readData4Map("gsrt_signedlist", "signedlist");

            
            if (map.containsKey("tranDateTime")) {
                map.remove("tranDateTime");
                map.put("tranDateTime", DateUtils.format(new Date(), "yyyyMMddHHmmss"));
            }

            mv = new ModelAndView("gsrt.signed.signed");
            mv.addObject("config", map);
        } catch (Exception e) {
            logger.error("跳转到转账页面异常", e);
        }

        return mv;
    }
    
    /**
     * 标的查询
     * 
     * @return
     */
    @RequestMapping("/dosigned")
    public ModelAndView dosigned(@ModelAttribute GsrtSignedListParamVo paramVo) {
        ModelAndView mv = new ModelAndView();

        try {
            String backgroundMerUrl = paramVo.getBackgroundMerUrl();
            if(backgroundMerUrl!=null&&!backgroundMerUrl.equals("")){
                backgroundMerUrl = backgroundMerUrl+ "?id="+ paramVo.getVerficationCode();
            }
            
            String frontMerUrl = paramVo.getFrontMerUrl();
            if(frontMerUrl!=null&&!frontMerUrl.equals("")){
                frontMerUrl = frontMerUrl+ "?id="
                        + paramVo.getVerficationCode();
            }
            paramVo.setBackgroundMerUrl(backgroundMerUrl);
            paramVo.setFrontMerUrl(frontMerUrl);
            
            //国付宝服务器时间,本应该从网关time接口获取,此处为方便测试,取页面上的可输入时间
            paramVo.setGopayServerTime(paramVo.getTranDateTime());
            
            // 签名
            p2PSignHandler.sign(paramVo.getTranCode()+"_"+paramVo.getVersion(), "signType", "signValue", paramVo, getRequest());
            
           
            
            mv.setViewName("gsrt.signed.dosigned");
            mv.addObject("paramVo", paramVo);
        } catch (Exception e) {
            logger.error("执行提现异常", e);
        }

        return mv;
    }

    /**
     * 赵亚亭
     * 充提转查询
     * @return
     */
    @RequestMapping("/rdtQuery")
    public ModelAndView rdtQuery() {
        ModelAndView mv = new ModelAndView();

        try {
            Map<String, String> map = xmlDao.readData4Map("gsrt_rdtQuery", "rdtQuery");

            
            if (map.containsKey("tranDateTime")) {
                map.remove("tranDateTime");
                map.put("tranDateTime", DateUtils.format(new Date(), "yyyyMMddHHmmss"));
            }

            mv = new ModelAndView("gsrt.rdtQuery.rdtQuery");
            mv.addObject("rdtQueryInfo", map);
        } catch (Exception e) {
            logger.error("跳转到转账页面异常", e);
        }

        return mv;
    }
    
    /**
     * 赵亚亭
     * 充提转查询
     * @return
     */
    @RequestMapping("/doRdtQuery")
    public ModelAndView doRdtQuery(@ModelAttribute GsrtRdtQueryParamVo paramVo) {
        ModelAndView mv = new ModelAndView();

        try {
            String backgroundMerUrl = paramVo.getBackgroundMerUrl();
            if(backgroundMerUrl!=null&&!backgroundMerUrl.equals("")){
                backgroundMerUrl = backgroundMerUrl+ "?id="+ paramVo.getVerficationCode();
            }
            
            String frontMerUrl = paramVo.getFrontMerUrl();
            if(frontMerUrl!=null&&!frontMerUrl.equals("")){
                frontMerUrl = frontMerUrl+ "?id="
                        + paramVo.getVerficationCode();
            }
            paramVo.setBackgroundMerUrl(backgroundMerUrl);
            paramVo.setFrontMerUrl(frontMerUrl);
            
            //国付宝服务器时间,本应该从网关time接口获取,此处为方便测试,取页面上的可输入时间
            paramVo.setGopayServerTime(paramVo.getTranDateTime());
            
            // 签名
            gsrtHandler.sign(paramVo.getTranCode()+"_"+paramVo.getVersion(), "signType", "signValue", paramVo, getRequest());
            
           
            
            mv.setViewName("gsrt.rdtQuery.doRdtQuery");
            mv.addObject("paramVo", paramVo);
        } catch (Exception e) {
            logger.error("执行提现异常", e);
        }

        return mv;
    }
    /**
     * 跳到G商融通的主页
     * @return
     */
    @RequestMapping("/gsrtPage")
    public ModelAndView gsrtPage() {
    	ModelAndView mv = new ModelAndView();
    	mv.setViewName("gsrt.menu.page");
    	return mv;
    }
    /**
     * 返回到主页面
     * @return
     */
    @RequestMapping("/backIndexPage")
    public ModelAndView backIndexPage() {
    	ModelAndView mv = new ModelAndView();
    	mv.setViewName("gopay.webtest.def");
    	return mv;
    }
}
